package jun.learn.thread.lock;

public class ReentrantLockTest {
	
	
	public static void main(String[] args) {
		
	}
}



class DepositThread extends Thread{
	
	private Acount count;
	private double a;
	
	public DepositThread(Acount count,double a) {
		this.count = count;
		this.a = a;
	}

	@Override
	public void run() {
		count.deposit(a);
	}
}


class Acount{
	
	private double balance = 600;
	
	public Acount() {
	}
	
	public Acount(double balance) {
		super();
		this.balance = balance;
	}

	public boolean draw(double a){
		boolean flag = true;
		if(a > balance){
			flag = false;
		}
		balance = balance - a;
		return flag;
	}
	
	public void deposit(double a){
		balance = balance + a;
	}
	
}